Primitive Class Vec3
Represents a 3D vector.
Members
x | (int) x coordinate |
y | (int) y coordinate |
z | (int) z coordinate |
Functions
Vec3:ToLength(length) | Modify this vector so that it becomes close to the requested length. |
Vec3(X, Y, Z) | |
__tostring(Vec3) | Metafunction; use tostring(myVector) |
Members
Functions
- Vec3:ToLength(length)
-
Modify this vector so that it becomes close to the requested length.
Note that since the engine uses integers instead of floating-point numbers, this will be less accurate at smaller lengths. For example, if you have the vector (100, 600, 700) and set it to the length of 1, the vector SHOULD become approximately (0.11, 0.65, 0.75). However, this function would return it as (0, 1, 1).
Parameters:
- length float the new length to set the vector to.
- Vec3(X, Y, Z)
-
Parameters:
- X int x coordinate
- Y int y coordinate
- Z int z coordinate
Returns:
-
Vec3
A Vec3 object.
- __tostring(Vec3)
-
Metafunction; use tostring(myVector)
Parameters:
- Vec3 Vec3 this Vec3
Returns:
-
string
A string showing the x, y, and z values of the Vec3